# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-yuin-goldmark
pkgver=1.4.13
pkgrel=2
pkgdesc="A markdown parser written in Go"
arch=('any')
url="https://github.com/yuin/goldmark"
license=('BSD')
depends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/yuin/goldmark/archive/v$pkgver.tar.gz")
sha512sums=('82f6c3b8852a41d4072e1b88a70299e74234f5bf1e0fef2236d501edcde2586391fa05957fb30bd5c1c92361a6bd19e9105423ca3ce4f29a807a860674ece2e3')

check() {
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/yuin
  cp -a "$srcdir"/goldmark-$pkgver "$srcdir"/build/src/github.com/yuin/goldmark
  cd "$srcdir"/build/src/github.com/yuin/goldmark
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/yuin
  cp -a "$srcdir"/goldmark-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/yuin/goldmark

  install -Dm644 goldmark-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
